import 'package:appflutterhomeschool/res/styles.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:provider/provider.dart';

import 'discuss_view_model.dart';

//发送组件
class SendOutWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    DiscussViewModel discussViewModel = Provider.of(context);
    return Container(
      color: Colors.white,
      height: ScreenUtil().setWidth(134),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.center,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: <Widget>[
          Expanded(
            child: Padding(
              padding: EdgeInsets.only(left: 20, right: 20, top: 5, bottom: 5),
              child: TextField(
                //是否显示密码
                obscureText: false,
                //是否禁用
                autofocus: false,
                controller: discussViewModel.textEditingController,
                style: TextStyles.textDark43,
                decoration: InputDecoration(
                  contentPadding: EdgeInsets.only(top: 5, left: 10),
                  fillColor: Colors.grey[300],
                  filled: true,
                  border: OutlineInputBorder(
                      borderRadius: BorderRadius.circular(50),
                      borderSide: BorderSide.none),
                  hintText: '',
                  counterText: "",
                  hintStyle: TextStyles.textGrey43,
                ),
                onChanged: (value) {},
              ),
            ),
          ),
          MaterialButton(
            minWidth: ScreenUtil().setWidth(200),
            height: ScreenUtil().setWidth(92),
            //按钮失效时的颜色
            disabledColor: Colors.grey,
            //按钮背景色
            color: Colors.blue,
            //点击按钮时水波纹颜色
//      splashColor: ColorHelper.mainPressBlueColor,
            //长按后的颜色
//      highlightColor: ColorHelper.disableColor,
            //阴影的范围，值越大阴影范围越大
//        elevation: 100.0,
            shape: StadiumBorder(),
            padding: EdgeInsets.only(top: 10, bottom: 10),
            child: Text("发送", style: TextStyles.textWhite37),
            onPressed: discussViewModel.sendOutOnTap,
          ),
          SizedBox(width: 10)
        ],
      ),
    );
  }
}
